<template>
  <div class="enterprise-information">
    <div class="enterprise-information-main">
      <enterprise-form :model="enterpriseInfo" :preview="!isEdit" />
    </div>
    <div class="enterprise-information-footer">
      <el-button type="primary" v-if="!isEdit" @click="isEdit = !isEdit">编辑</el-button>
      <template v-else>
        <el-button @click="submit" type="primary">保存</el-button>
        <el-button @click="isEdit = !isEdit">取消</el-button>
      </template>
    </div>
  </div>
</template>

<script setup>
import useEnterpriseStore from '@/stores/enterprise'
import EnterpriseForm from './form.vue'
import { storeToRefs } from 'pinia'
import { ref } from 'vue'
const enterpriseStore = useEnterpriseStore()
const enterpriseInfo = storeToRefs(enterpriseStore).enterprise

const isEdit = ref(false)
const submit = () => {}
</script>

<style lang="scss">
.enterprise-information {
  position: relative;
  height: 100%;
  &-main {
    padding: 20px;
    height: calc(100% - 52px);
  }
  &-footer {
    width: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
    height: 52px;
    padding: 10px;
    box-shadow: 6px 6px 12px 6px rgba(0, 0, 0, 0.08);
  }
}
</style>
